<script>
$(document).ready(function() {
	<?php
	if ($updated == 1) echo 'showNoti("Đơn hàng: '.$name.'", "Cập nhập đơn hàng thành công!", "Ok");';
	if ($failed == 1) echo 'showNoti("Đơn hàng: '.$name.'", "Cập nhập đơn hàng thất bại!", "Err");';
	?>	
});
</script>
<?php 
echo form_open($action, array('id' => 'updateFrm'));
echo form_input(array('type' => 'hidden', 'name' => 'token', 'value' => $GLOBALS['var']['token']));
echo form_input(array('type' => 'hidden', 'name' => 'id', 'value' => $info['id']));
echo form_input(array('type' => 'hidden', 'name' => 'ma', 'value' => $info['ma']));
echo module_open();
?>
<tr class="no-border">
    <td class="fr">
        <div class="tdleft clr320" style="min-width: 300px; text-align: left; line-height: normal">
            <h1>ĐỊA CHỈ THANH TOÁN</h1>
            <h2><?php echo $info['ten_nguoimua'] ?></h2>
            <p><?php echo $info['diachi_nguoimua'] ?></p>
            <p>Tel: <?php echo $info['dienthoai_nguoimua'] ?></p>
            <p>Email: <?php echo $info['email_nguoimua'] ?></p>
        </div>
        <div class="tdleft clr320" style="min-width: 300px; text-align: left; line-height: normal">
            <h1>ĐỊA CHỈ GIAO HÀNG</h1>
            <h2><?php echo $info['ten_nguoinhan'] ?></h2>
            <p><?php echo $info['diachi_giaohang'] ?></p>
            <p>Tel: <?php echo $info['dienthoai_nguoinhan'] ?></p>
            <p>Ghi chú: <?php echo $info['khachhang_ghichu'] ?></p>
        </div>
        <div class="tdleft clr320" style="min-width: 300px; text-align: left; line-height: normal">
            <h1>THÔNG TIN HÓA ĐƠN</h1>
            <h2>Mã hóa đơn: <?php echo $info['ma'] ?></h2>
            <p>Ngày đặt hàng: <?php echo strftime(TIME_STR, strtotime($info['date_added'])) ?></p>
            <p>
                <div style="float: left;">Tình trạng:</div>
                <?php
                if ($GLOBALS['per']['edit'])
                {
                ?>
                <div style="float: left; margin-top: -6px; margin-left: 5px;"><?php echo form_dropdown('status', $status_arr, $info['status']); ?></div>
                <?php
                }
                else echo '<div style="float: left; margin-left: 5px;">'.$GLOBALS['orders_status'][$info['status']].'</div>';
                ?> 
            </p>
            <p style="clear: both; padding-top: 5px;">Hình thức thanh toán: <?php echo ($info['phuongthuc_thanhtoan'] == 0? 'tiền mặt' : ($info['phuongthuc_thanhtoan'] == 1 ? 'chuyển khoản' : ($info['phuongthuc_thanhtoan'] == 2 ? 'Paypal' : ($info['phuongthuc_thanhtoan'] == 3 ? 'Ngânlượng.vn' : ($info['phuongthuc_thanhtoan'] == 4 ? 'BảoKim.vn' : 'Sohapay'))))) ?></p>
        </div>
    </td>
</tr>
<tr class="no-border">
	<td>&nbsp;</td>
</tr>
<tr class="no-border">
	<td class="fr" style="border: none;">
		<table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tr class="no-border" id="first">
                <td class="head" width="2%">#</td>
                <td class="head hide480" width="430px">Sản phẩm</td>
                <td class="head center" align="center" width="100px">Mã hàng</td>	
                <td class="head center" width="30px">SL</td>
                <td class="head right" width="65px">Đơn Giá</td>
                <td class="head right" width="65px">Thành tiền</td>
            </tr>
            <?php
            $products = $methods->product_list($info['ma']);
            if (count($products) && is_array($products))
            {
	            $i = 1;
	            foreach ($products as $pro)
	            {
            ?>
            <tr class="no-border">
                <td class="fr" width="2%"><?php echo $i++ ?></td>
                <td class="fr hide480" width="430px">
                	<?php echo show_img(PRO.'gallery/'.$pro['img'], '', 'max-width:30px; max-height:40px;') ?>
                	<?php echo $pro['name_vn'] ?>
                </td>
                <td class="fr center" align="center" width="100px"><?php echo $pro['code'] ?></td>	
                <td class="fr center" width="30px"><?php echo number_format($pro['soluong']) ?></td>
                <td class="fr right" width="65px"><?php echo number_format($pro['gia']) ?></td>
                <td class="fr right" width="65px"><?php echo number_format($pro['tongcong']) ?>đ</td>
            </tr>
            <?php
            	}
        	}
            if ($info['vat'] || $info['giam_coupon'] || $info['phi_giaohang'])
            {
            	echo '<tr class="no-border">';
            	echo '<td class="fr right" colspan="6" style="border: none;">Tổng cộng: <span style="display: inline-block; width:80px;">'.number_format($info['tongcong']).'đ</span></td>';
            	echo '</tr>';
            }
            if ($info['vat'])
            {
            	echo '<tr class="no-border">';
            	echo '<td class="fr right" colspan="6" style="border: none;">VAT 10%: <span style="display: inline-block; width:80px;">'.number_format($info['vat']).'đ</span></td>';
            	echo '</tr>';
            }
            if ($info['giam_coupon'])
            {
            	echo '<tr class="no-border">';
            	echo '<td class="fr right" colspan="6" style="border: none;">Giảm Coupon: <span style="display: inline-block; width:80px;">'.number_format($info['giam_coupon']).'đ</span></td>';
            	echo '</tr>';
            }
            if ($info['phi_giaohang'])
            {
            	echo '<tr class="no-border">';
            	echo '<td class="fr right" colspan="6" style="border: none;">Phí giao hàng: <span style="display: inline-block; width:80px;">'.number_format($info['phi_giaohang']).'đ</span></td>';
            	echo '</tr>';
            }
            ?>
            <tr class="no-border">
            	<td class="fr right strong" colspan="6" style="border: none;">Thanh toán: <span style="display: inline-block; width:80px;"><?php echo number_format($info['tien_thanhtoan']) ?>đ</span></td>
            </tr>
            <tr class="no-border">
            	<td class="fr right" colspan="6" style="border: none;"><em>Bằng chữ: <?php echo doiso($info['tien_thanhtoan']) ?> đồng</em></td>
            </tr>
        </table>
	</td>
</tr>
<?php echo module_close(); ?>